package org.wxd.rpc.dubbo.annotation;

import com.alibaba.dubbo.config.annotation.Reference;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;
import org.wxd.category.api.CategoryQueryService;
import org.wxd.category.api.CategoryService;
import org.wxd.category.api.dto.CategoryAddRequest;
import org.wxd.category.api.dto.CategoryGetRequest;
import org.wxd.category.api.dto.CategoryRecord;

/**
 * Created by wangxd on 16/8/25.
 */
@Component
public class DubboAnnotationConsumer {

    @Reference(version = "1.0.0")
    private CategoryQueryService categoryQueryService;
    @Reference(version = "1.0.0")
    private CategoryService categoryService;

    public void test() {
        CategoryRecord record = categoryService.addCategory(CategoryAddRequest.buildeParentCategory("parent", Maps.<String, String>newConcurrentMap()));

        System.out.println(categoryQueryService.get(new CategoryGetRequest(record.id())));
    }
}
